<div class="login_body" id="memberLogin">
    <div class="login_cont pub_wid">
        <h1><a href="/"><img src="/static/index/public/images/logo_b.png" /></a></h1>
        <div class="widthauto">
            <div class="login_box rg">
                <h2>账号登录</h2>
                <ul class="widthauto">
                    <li><span>登录账号</span><br />
                        <input v-model="phone" name="" type="text" placeholder="请输入手机号" class="inp"/>
                    </li>
                    <li><span>登录密码</span><br />
                        <input v-model="password" name="" type="password" placeholder="请输入登录密码" class="inp"/>
                    </li>
                    <li>
                        <input name="" type="checkbox" value="" class="chos"/>
                        记住密码<a href="/index/member/changePassword">忘记密码？</a></li><br /><br /><br />
                </ul>
                <h3>
                    <a @click="memberLogin()">登录</a></h3>
                <p>还没有账号？<a href="/index/member/index">立即注册</a></p>
            </div>
        </div>
    </div>
</div>
{include file="public/account_footer"}
<script>
    var vmMemberLogin = new Vue({
        el:'#memberLogin',
        data:{
            phone:'',
            password:'',
        },
        methods:{
            memberLogin:function () {
                var el = this;
                var postData = {
                    'phone':el.phone,
                    'password':el.password
                }
                AjaxPost(postData,'/index/member/loginCheck').then((response)=>{
                    console.log(response);
                    localStorage.clear();
                    var memberData = response.result;
                    if(response.status==1){
                        localStorage.setItem("memberPhone", response.result.phone);
                        localStorage.setItem("memberId", response.result.id);
                            // console.log(memberData.memberInfo.member_grade)
                        if(memberData.memberInfo == null){
                            window.location.href='/index/member/loginSuccess'
                        }else{
                            localStorage.setItem("member_category", memberData.memberInfo.member_category);
                            localStorage.setItem("member_grade", memberData.memberInfo.member_grade);
                            localStorage.setItem("member_status", memberData.memberInfo.status);
                            if(memberData.memberInfo.member_category == 1){
                                window.location.href='/index/consignor/index'
                            }else if(memberData.memberInfo.member_category == 2){
                                window.location.href='/index/logistics/index'
                            }else {
                                window.location.href='/index/member/loginSuccess'
                            }

                        }
                    }

                })
            }

        },
        mounted(){

        }
    })
</script>